
/**
 * 邮箱
 */
function isEmail(s) {
  return /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((.[a-zA-Z0-9_-]{2,3}){1,2})$/.test(s)
}

/**
 * 手机号码
 */
function isMobile(s) {
  return /^1[0-9]{10}$/.test(s)
}

/**
 * URL地址
 */
function isURL(s) {
  return /^http[s]?:\/\/.*/.test(s)
}

export default {
  must: {
    required: true,
    message: '必填',
    trigger: ['blur', 'change']
  },
  url: {
    validator: isURL,
    message: 'url地址输入格式不正确',
    trigger: ['blur']
  },
  email: {
    validator: isEmail,
    message: '邮箱地址输入格式不正确',
    trigger: ['blur']
  },
  mobile: {
    validator: isMobile,
    message: '输入手机号码不正确',
    trigger: ['blur']
  }
}

